<template>
  <common-list>
    <!-- 头部搜素start -->
    <common-search slot="search" @search="handleQuery" @reset="resetQuery">
      <el-form
        :model="query"
        @submit.native.prevent
        ref="queryForm"
        v-show="showSearch"
        :inline="true"
        label-width="65px"
      >
        <el-form-item label="数据名称" prop="dictLabel">
          <common-input
            v-model="query.dictLabel"
            clearable
            @enter="handleQuery"
          />
        </el-form-item>

        <!-- <el-form-item label="字典类型" prop="dictName">
          <el-select v-model="query.dictName" filterable>
            <el-option label="全部" :value="null"></el-option>
            <el-option
              v-for="(item, index) in optionDicArr"
              :key="item.dictId"
              :label="item.dictName"
              :value="item.dictName"
            ></el-option>
          </el-select>
        </el-form-item> -->
      </el-form>
    </common-search>
    <!--列表 start-->
    <common-table slot="content" v-loading="loading" :data="list">
      <el-table-column
        label="数据名称"
        align="left"
        prop="dictLabel"
        show-overflow-tooltip
        width="400"
      >
        <template slot-scope="{ row }">{{ row.dictLabel }}</template>
      </el-table-column>

      <!-- <el-table-column
        label="字典类型"
        align="left"
        prop="dictName"
        width="200"
      >
        <template slot-scope="{ row }">{{ row.dictName }}</template>
      </el-table-column> -->

      <el-table-column
        label="内容"
        align="left"
        prop="dictValue"
        width="220"
        show-overflow-tooltip
      >
        <template slot-scope="{ row }">{{ row.dictValue }}</template>
      </el-table-column>

      <el-table-column
        label="备注"
        align="left"
        prop="remark"
        show-overflow-tooltip
      >
        <template slot-scope="{ row }">{{ row.remark }}</template>
      </el-table-column>

      <!-- <el-table-column label="操作" align="left" width="125">
        <template slot-scope="{ row }">
          <el-button type="text" @click="view(row.id)">详情</el-button>
        </template>
      </el-table-column> -->
    </common-table>

    <pagination
      slot="pagination"
      v-show="total > 0"
      :total="total"
      :page.sync="query.pageNum"
      :limit.sync="query.pageSize"
      @pagination="getList"
    />
  </common-list>
</template>

<script>
import { alarmParams } from "@/api/management/configure/index.js";
export default {
  components: {},
  props: {},
  data() {
    return {
      query: {
        pageNum: 1,
        pageSize: 10,
        dictName: null,
      },
      total: 1,
      showSearch: true,
      list: [],
      loading: false,
    };
  },
  watch: {},
  computed: {},
  methods: {
    resetQuery() {
      this.query = this.$options.data().query;
    },
    handleQuery() {
      this.query.pageNum = 1;
      this.getList();
    },
    getList() {
      let query = { ...this.query };
      this.loading = true;
      alarmParams(query)
        .then((res) => {
          if (res && res.code === 200) {
            this.list = res.rows;
            this.total = res.total;
          } else {
            this.list = [];
            this.total = 0;
            this.handleListTips(res);
          }
        })
        .finally(() => {
          this.loading = false;
        });
    },

  },
  created() {
    this.getList();
  },
  mounted() {},
};
</script>
<style lang="scss" scoped></style>
